/**
 * FileName: TableTests Author:   baoy Date:     2018/10/12 14:26 Description:
 */
package com.baoy.xxx.guava.map;

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class TableTests {


    public static void main(String[] arg) {
        Table<Integer, Integer, Integer> weightedGraph = HashBasedTable.create();
        weightedGraph.put(1, 2, 4);
        weightedGraph.put(1, 3, 20);
        weightedGraph.put(2, 3, 5);
        //返回某一行的列对应值的map
        log.info("{}", weightedGraph.row(1)); // returns a Map mapping 2 to 4, 3 to 20

        //返回某一列的行对应值的map
        log.info("{}", weightedGraph.column(3));// returns a Map mapping 1 to 20, 2 to 5
    }
}
